package com.oocl.pojo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;

import com.oocl.util.DateUtil;

public class Protocol implements Serializable,Cloneable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/*
	 * 交互协议类型：1登陆，2退出，3私聊，4群聊，5震屏（个人），6震屏（集体）
	 * 8 回馈新用户登陆成功，
	 * 9 通知所有在线用户有用户登陆成功
	 * 10 通知所有用户有用户退出
	 */
	private int type;	
	private String from="";
	private String to="";
	private String content="";
	private Date time;
	private ArrayList<String> onlineUsers;
	
	public Protocol() {
	}
	
	public Protocol(int type, String from, String to, String content,
			Date time) {
		super();
		this.type = type;
		this.from = from;
		this.to = to;
		this.content = content;
		this.time = time;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	public String getTo() {
		return to;
	}

	public void setTo(String to) {
		this.to = to;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	public ArrayList<String> getOnlineUsers() {
		return onlineUsers;
	}

	public void setOnlineUsers(ArrayList<String> onlineUsers) {
		this.onlineUsers = onlineUsers;
	}

	@Override
	protected Object clone() throws CloneNotSupportedException {
		// TODO Auto-generated method stub
		return super.clone();
	}

	@Override
	public String toString() {
		return "Protocol [type=" + type + ", from=" + from + ", to=" + to
				+ ", content=" + content + ", time=" + DateUtil.dateToStr(time, "HH:mm:ss") + ", onlineUsers="
				+ onlineUsers + "]";
	}

	
	
}
